(*
  Copyright (c) 2009 Barry Schwartz

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation
  files (the "Software"), to deal in the Software without
  restriction, including without limitation the rights to use,
  copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the
  Software is furnished to do so, subject to the following
  conditions:

  The above copyright notice and this permission notice shall be
  included in all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  OTHER DEALINGS IN THE SOFTWARE.
*)

type file_type =
  [ | `PK | `Source | `TeX | `TFM | `AFM | `Type1 | `TrueType | `OpenType
  ]

val find_file : string -> file_type -> bool -> string
val find_glyph : string -> int -> string

val kpse_gf_format : int
val kpse_pk_format : int
val kpse_any_glyph_format : int
val kpse_tfm_format : int
val kpse_afm_format : int
val kpse_base_format : int
val kpse_bib_format : int
val kpse_bst_format : int
val kpse_cnf_format : int
val kpse_db_format : int
val kpse_fmt_format : int
val kpse_fontmap_format : int
val kpse_mem_format : int
val kpse_mf_format : int
val kpse_mfpool_format : int
val kpse_mft_format : int
val kpse_mp_format : int
val kpse_mppool_format : int
val kpse_mpsupport_format : int
val kpse_ocp_format : int
val kpse_ofm_format : int
val kpse_opl_format : int
val kpse_otp_format : int
val kpse_ovf_format : int
val kpse_ovp_format : int
val kpse_pict_format : int
val kpse_tex_format : int
val kpse_texdoc_format : int
val kpse_texpool_format : int
val kpse_texsource_format : int
val kpse_tex_ps_header_format : int
val kpse_troff_font_format : int
val kpse_type1_format : int
val kpse_vf_format : int
val kpse_dvips_config_format : int
val kpse_ist_format : int
val kpse_truetype_format : int
val kpse_type42_format : int
val kpse_web2c_format : int
val kpse_program_text_format : int
val kpse_program_binary_format : int
val kpse_miscfonts_format : int
val kpse_web_format : int
val kpse_cweb_format : int
val kpse_enc_format : int
val kpse_cmap_format : int
val kpse_sfd_format : int
val kpse_opentype_format : int
val kpse_pdftex_config_format : int
val kpse_lig_format : int
val kpse_texmfscripts_format : int
val kpse_lua_format : int
val kpse_last_format : int

val kpse_ant_format : int

val kpse_init_prog : string -> int -> string -> string -> unit
val kpse_set_program_name : string -> string -> unit
val kpse_set_program_enabled : int -> int -> int -> unit
val kpse_find_file : string -> int -> bool -> string
val kpse_find_glyph : string -> int -> int -> string
val kpse_var_value : string -> string
val kpse_var_expand : string -> string
val kpse_expand : string -> string
val kpse_brace_expand : string -> string
val kpse_path_expand : string -> string
val kpse_path_search : string -> string -> bool -> string

val find_resource : ?format:int -> ?must_exist:bool -> string -> string
